/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.pb138.ulohy.uloha3.entities;

/**
 *
 * @author stefan
 */
public enum RealEstateType {
    
    APPARTMENT("appartment"), HOUSE("house"), LAND("land"), FOREST("forest");
    
    private String value;
    
    RealEstateType(String value) {
        this.value = value;
    }
    
    public static RealEstateType fromValue(String value) {
        for(RealEstateType realEstateType : values()) {
            if(realEstateType.value.equals(value)) return realEstateType;
        }
        throw new IllegalArgumentException("RealEstateType " + value + " does not exist");
    }
    
    public static RealEstateType fromOrdinal(int i) {
        switch(i) {
            case 0: return APPARTMENT;
            case 1: return HOUSE;
            case 2: return LAND;
            case 3: return FOREST;
        }
        
        throw new IllegalArgumentException("Illegal ordinal: " + i);
    }
}
